home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 3 / Info_Mac_1994-01.iso / Development / Source / MSG Graphic Effects 1.0 Source / SlideWipe.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-08-21  |  2.5 KB  |  89 lines  |  [TEXT/KAHL]

  1. /*******************************************************************************
  2.  * Copywrite © 1992-1993 David S. Blumenthal                                   *
  3.  *                                                                             *
  4.  * This file is provided as is, and may be freely distributed unaltered.  This *
  5.  * message must accompany any copy of this file.  This file may be used or     *
  6.  * modified for use for a non-commercial product provided that appropriate     *
  7.  * credit is given to the author named above.                                  *
  8.  * Commercial use of this source code is prohibited.                           *
  9.  ******************************************************************************/
  10.  
  11. #include "msg misc.h"
  12. #include "msg timing.h"
  13.  
  14. #define        BoxSize        20
  15. #define        StripSize    40
  16. #define CorrectTime 1
  17.  
  18. void SlideWipe(GrafPtr);
  19.  
  20. void SlideWipe(GrafPtr myGrafPtr)
  21. {
  22.     int            x, y;
  23.     Rect        theRect, dest;
  24.     Rect        scrollsource, scrolldest;
  25.     int            direction;
  26.     
  27.     direction = 0;
  28.     
  29.     for(y = 0; y < MAIN_WINDOW_HEIGHT; y += StripSize)
  30.     {
  31.         scrollsource = gMainWindow->portRect;
  32.         scrollsource.top = scrollsource.top + y;
  33.         scrollsource.bottom = scrollsource.top + StripSize;
  34.         
  35.         scrolldest = scrollsource;
  36.         
  37.         dest = gMainWindow->portRect;
  38.         dest.top = dest.top + y;
  39.         dest.bottom = dest.top + StripSize;
  40.         
  41.         theRect.top = y;
  42.         theRect.bottom = y + StripSize;
  43.         
  44.         if(direction == 0)
  45.         {
  46.             OffsetRect(&scrolldest, BoxSize, 0);
  47.             
  48.             dest.right = dest.left + BoxSize;
  49.             
  50.             theRect.left = MAIN_WINDOW_WIDTH - BoxSize;
  51.             theRect.right = MAIN_WINDOW_WIDTH;
  52.             
  53.             for(x = MAIN_WINDOW_WIDTH - BoxSize; x >= 0; x -= BoxSize)
  54.             {
  55.                 StartTiming();
  56.                 theRect.left = x;
  57.                 CopyBits(&(gMainWindow->portBits), &(gMainWindow->portBits),
  58.                         &scrollsource, &scrolldest, 0, 0L);
  59.                 CopyBits(&(myGrafPtr->portBits), &(gMainWindow->portBits),
  60.                         &theRect, &dest, 0, 0L);
  61.                 theRect.right = x;
  62.                 TimeCorrection(CorrectTime);
  63.             }
  64.         }
  65.         else
  66.         {
  67.             OffsetRect(&scrolldest, -BoxSize, 0);
  68.             
  69.             dest.left = dest.right - BoxSize;
  70.             
  71.             theRect.left = 0;
  72.             theRect.right = BoxSize;
  73.             
  74.             for(x = BoxSize; x <= MAIN_WINDOW_WIDTH; x += BoxSize)
  75.             {
  76.                 StartTiming();
  77.                 theRect.right = x;
  78.                 CopyBits(&(gMainWindow->portBits), &(gMainWindow->portBits),
  79.                         &scrollsource, &scrolldest, 0, 0L);
  80.                 CopyBits(&(myGrafPtr->portBits), &(gMainWindow->portBits),
  81.                         &theRect, &dest, 0, 0L);
  82.                 theRect.left = x;
  83.                 TimeCorrection(CorrectTime);
  84.             }
  85.         }
  86.         
  87.         direction = 1 - direction;
  88.     }
  89. }